********************************************************************************
***
*** 	Replication files for Zhuang, Maiting. 2022.
***
*** 	"Intergovernmental Conflict and Censorship: Evidence from China's 
***
***		Anti-Corruption Campaign" 
***
***		Journal of the European Economic Association
***
****************************************************************

*** 	Do-file for Tables and Figures based on the official-newspaper-day panel
***		in main text and Appendix E

clear

global dir "your directory path"

use "$dir/data/ofnppanel.dta"


********************************************************************************

*** TABLE 2 - Underreporting of local corruption scandals

reghdfe article 1.of_high#1.post#1.own_province 1.of_high#1.post 0.of_high#1.post#1.own_province 0.of_high#1.post, noconst absorb(onid) vce(cluster np of)
estadd ysumm
estadd scalar N1=e(N_clust1)
estadd scalar N2=e(N_clust2)
estimates store model3

reghdfe article 1.of_high#1.post#1.own_province 1.of_high#1.post 0.of_high#1.post#1.own_province 0.of_high#1.post  i.dofw i.month i.year date_cny_broad date_duanwu_broad date_zhongqiu_broad date_congress date_committee date_zhengxie date_renda ccpprov lhprov, noconst absorb(onid ) vce(cluster np of)
estadd ysumm
estadd scalar N1=e(N_clust1)
estadd scalar N2=e(N_clust2)
estimates store model4

esttab model3 model4 using "$dir/output/Table2.tex", ///
	keep(1.of_high#1.post#1.own_province 1.of_high#1.post 0.of_high#1.post#1.own_province 0.of_high#1.post) b(a2) se(a2) /// 
	order(1.of_high#1.post#1.own_province 1.of_high#1.post 0.of_high#1.post#1.own_province 0.of_high#1.post) /// 
	nodepvar replace label interaction(" x ") star(* 0.10 ** 0.05 *** 0.01) booktabs noobs ///
	varlabels(1.of_high#1.post#1.own_province "\shortstack[l]{High-level official x\\Post-scandal x Same province}" ///
	0.of_high#1.post#1.own_province "\shortstack[l]{Low-level official x\\Post-scandal x Same province}" 1.of_high#1.post "\shortstack[l]{High-level official x\\Post-scandal}" ///
	0.of_high#1.post "\shortstack[l]{Low-level official x\\Post-scandal}") ///
	fragment nomtitle nonumber nolines 
esttab  model3 model4 using "$dir/output/Table2_bottom.tex", cell(none) /// 
	stats(N N2 N1 r2 ymean, fmt(%16.0fc a2 a2) label("No. of obs." "No. of clusters (officials)" "No. of clusters (newspapers)" "R-squared" "Mean dep. var.")) ///
	fragment label replace collabels(none) noobs nomtitle nonumber nolines 	

	
********************************************************************************

*** FIGURE 2 and TABLE E.1 - Muncipality-Level Underreporting

reghdfe article 1.post#2.opc 1.post#1.opc 1.post ///
	i.dofw i.month i.year date_cny_broad date_duanwu_broad date_zhongqiu_broad date_congress date_committee date_renda date_zhengxie ccpprov lhprov ///
	if np_level==2 & of_level==2 , noconstant absorb(onid) vce(cluster of np)
estadd ysumm

coefplot, keep (1.post#2.opc 1.post#1.opc 1.post) ///
	coeflabels(1.post#1.opc = "Post x Different City" 1.post#2.opc = "Post x Same City" 1.post = "Post", interaction(" x ") wrap(10)) ytitle("") ///
	vertical yline(0) ysc(r(0)) ylabel(#5) recast(bar) ciopts(recast(rcap)) citop barwidt(0.3) levels(90) fcolor(gs10) scheme(s1mono)
graph export "$dir/output/Figure2.pdf", replace

test 1.post#2.opc=1.post#1.opc
estadd scalar p1=r(p)

esttab using "$dir/output/TableE1.tex", ///
	drop(*.dofw *.month *.year date_* ccpprov lhprov) b(a2) se(a2) /// 
	order(1.post#2.opc  1.post#1.opc   1.post  ) ///
	varlabels(1.post#1.opc "Post x Different city" 1.post#2.opc "Post x Same City" 1.post  "Post") ///
	nodepvar replace label interaction(" x ") star(* 0.10 ** 0.05 *** 0.01) booktabs noomitted nobaselevels noobs ///
	fragment nomtitle nonumber nolines ///
	stats(p1 N r2 ymean, fmt(%9.3f %16.0fc a2 a2) label("p(Different city = Same city)" ///
	"No. of obs." "R-squared" "Mean dep. var."))
	
	
********************************************************************************

*** FIGURE 3 and TABLE E.2 - Provincial vs. Sub-Provincial Newspapers

set more off
reghdfe article 1.np_level#1.of_high#1.post#1.own_province 2.np_level#1.of_high#1.post#1.own_province ///
	1.np_level#0.of_high#1.post#1.own_province 2.np_level#0.of_high#1.post#1.own_province ///
	1.np_level#1.of_high#1.post 2.np_level#1.of_high#1.post ///
	1.np_level#0.of_high#1.post 2.np_level#0.of_high#1.post ///
	i.dofw i.month i.year date_cny_broad date_duanwu_broad date_zhongqiu_broad date_congress date_committee date_renda date_zhengxie ccpprov lhprov ///
	if of_level==1 &np_level!=0, noconstant absorb(onid) vce(cluster of np)
estadd ysumm 

coefplot, keep (1.np_level#1.of_high#1.post#1.own_province 2.np_level#1.of_high#1.post#1.own_province 1.np_level#1.of_high#1.post 2.np_level#1.of_high#1.post ) ///
	coeflabels(1.np_level#1.of_high#1.post#1.own_province = "High OF x Provincial NP x Post x Same province" ///
	2.np_level#1.of_high#1.post#1.own_province = "High OF x Sub-provincial NP x Post x Same province" ///
	1.np_level#1.of_high#1.post = "High OF x Provincial NP x Post" ///
	2.np_level#1.of_high#1.post = "High OF x Sub-provincial NP x Post", wrap(10)) baselevels ///
	ytitle("") ///
	vertical yline(0) ysc(r(0)) ylabel(#5) recast(bar) ciopts(recast(rcap)) citop barwidt(0.3) levels(90) fcolor(gs10) scheme(s1mono)
graph export "$dir/output/Figure3a.pdf",  replace
coefplot, keep (1.np_level#0.of_high#1.post#1.own_province 2.np_level#0.of_high#1.post#1.own_province 1.np_level#0.of_high#1.post 2.np_level#0.of_high#1.post ) ///
	coeflabels(1.np_level#0.of_high#1.post#1.own_province = "Low OF x Provincial NP x Post x Same province" ///
	2.np_level#0.of_high#1.post#1.own_province = "Low OF x Sub-provincial NP x Post x Same province" ///
	1.np_level#0.of_high#1.post = "Low OF x Provincial NP x Post" ///
	2.np_level#0.of_high#1.post = "Low OF x Sub-provincial NP x Post", wrap(10)) baselevels ///
	ytitle("") ///
	vertical yline(0) ysc(r(0)) ylabel(#5) recast(bar) ciopts(recast(rcap)) citop barwidt(0.3) levels(90) fcolor(gs10) scheme(s1mono)
graph export "$dir/output/Figure3b.pdf",  replace

test 1.np_level#1.of_high#1.post#1.own_province=2.np_level#1.of_high#1.post#1.own_province
estadd scalar p1=r(p)
test 1.np_level#1.of_high#1.post=2.np_level#1.of_high#1.post
estadd scalar p2=r(p)
test 1.np_level#0.of_high#1.post#1.own_province=2.np_level#0.of_high#1.post#1.own_province
estadd scalar p3=r(p)
test 1.np_level#0.of_high#1.post=2.np_level#0.of_high#1.post
estadd scalar p4=r(p)

esttab using "$dir/output/TableE2.tex", ///
	drop(*.dofw *.month *.year date_* ccpprov lhprov) b(a2) se(a2) /// 
	order (1.np_level#1.of_high#1.post#1.own_province 2.np_level#1.of_high#1.post#1.own_province ///
	1.np_level#0.of_high#1.post#1.own_province 2.np_level#0.of_high#1.post#1.own_province ///
	1.np_level#1.of_high#1.post 2.np_level#1.of_high#1.post ///
	1.np_level#0.of_high#1.post 2.np_level#0.of_high#1.post) ///
	varlabels(1.np_level#1.of_high#1.post#1.own_province   "High OF x Provincial NP x Post x Same province" ///
	2.np_level#1.of_high#1.post#1.own_province   "High OF x Sub-provincial NP x Post x Same province" ///
	1.np_level#0.of_high#1.post#1.own_province   "Low OF x Provincial NP x Post x Same province" ///
	2.np_level#0.of_high#1.post#1.own_province   "Low OF x Sub-provincial NP x Post x Same province" 1.np_level#1.of_high#1.post   "High OF x Provincial NP x Post" ///
	2.np_level#1.of_high#1.post   "High OF x Sub-provincial NP x Post" ///
	1.np_level#0.of_high#1.post   "Low OF x Provincial NP x Post" ///
	2.np_level#0.of_high#1.post   "Low OF x Sub-provincial NP x Post") ///
	nodepvar replace label interaction(" x ") star(* 0.10 ** 0.05 *** 0.01) booktabs noobs ///
	fragment nomtitle nonumber nolines ///
	stats(p1 p2 p3 p4 N r2 ymean, fmt(%9.3f %9.3f %9.3f %9.3f %16.0fc a2 a2) label("p(Provincial NP = Sub-provincial NP) - High OF, same province" ///
	"p(Provincial NP = Sub-provincial NP) - High OF" ///
	"p(Provincial NP = Sub-provincial NP) - Low OF, same province" ///
	"p(Provincial NP = Sub-provincial NP) - Low OF" ///
	 "No. of obs." "R-squared" "Mean dep. var."))

********************************************************************************

*** FIGURE 4 and TABLE E.3 - Party newspapers vs. commercial newspapers

set more off
reghdfe article i.np_type#1.of_high#1.post#1.own_province i.np_type#1.of_high#1.post i.np_type#0.of_high#1.post#1.own_province i.np_type#0.of_high#1.post ///
	i.dofw i.month i.year date_cny_broad date_duanwu_broad date_zhongqiu_broad date_congress date_committee date_zhengxie date_renda ccpprov lhprov ///
	, noconstant absorb(onid) vce(cluster np of)
estadd ysumm

coefplot, keep (*.np_type#1.of_high#1.post#1.own_province 2.np_type#1.of_high#1.post#1.own_province 3.np_type#1.of_high#1.post#1.own_province) ///
	coeflabels(1.np_type#1.of_high#1.post#1.own_province="Party NP x High OF x Post x Same province" ///
	2.np_type#1.of_high#1.post#1.own_province="Govt. commercial NP x High OF x Post x Same province" ///
	3.np_type#1.of_high#1.post#1.own_province="Subsidiary NP x High OF x Post x Same province", interaction(" x ") wrap(10)) ytitle("")  ///
	baselevels vertical yline(0) ysc(r(0)) ylabel(#5) recast(bar) ciopts(recast(rcap)) citop barwidt(0.3) levels(90) fcolor(gs10) scheme(s1mono)
graph export "$dir/output/Figure4.pdf",  replace

test 1.np_type#1.of_high#1.post#1.own_province=2.np_type#1.of_high#1.post#1.own_province
estadd scalar p1=r(p)
test 1.np_type#1.of_high#1.post#1.own_province=3.np_type#1.of_high#1.post#1.own_province
estadd scalar p2=r(p)
test 2.np_type#1.of_high#1.post#1.own_province=3.np_type#1.of_high#1.post#1.own_province
estadd scalar p3=r(p)
test 1.np_type#1.of_high#1.post=2.np_type#1.of_high#1.post
estadd scalar p1n=r(p)
test 1.np_type#1.of_high#1.post=3.np_type#1.of_high#1.post
estadd scalar p2n=r(p)
test 2.np_type#1.of_high#1.post=3.np_type#1.of_high#1.post
estadd scalar p3n=r(p)

esttab using "$dir/output/TableE3.tex", replace ///
	drop(*.dofw *.month *.year date_* ccpprov lhprov) b(a2) se(a2) /// 
	order(*.np_type#1.of_high#1.post#1.own_province *.np_type#0.of_high#1.post#1.own_province *.np_type#1.of_high#1.post *.np_type#0.of_high#1.post) ///
	nodepvar label interaction(" x ") star(* 0.10 ** 0.05 *** 0.01) booktabs noobs ///
	fragment nomtitle nonumber nolines ///
	stats(p1 p2 p3 p1n p2n p3n N r2 ymean, fmt(%9.3f %9.3f %9.3f %9.3f %9.3f %9.3f %16.0fc a2 a2) label("p(Party NP = Govt. commercial NP) - same province" ///
	"p(Party NP = Subsidiary NP) - High OF, same province" "p(Govt.commercial NP = Subsidiary NP) - High OF, same province" ///
	"p(Party NP = Govt. commercial NP) - High OF" ///
	"p(Party NP = Subsidiary NP) - High OF" "p(Govt.commercial NP = Subsidiary NP) - High OF" ///
	"No. of obs." "R-squared" "Mean dep. var."))

********************************************************************************

*** FIGURE 5 and TABLE E.4 - Proximity of the Head of the Province

reghdfe article 1.ser#1.post#1.own_province 1.nser#1.post#1.own_province 1.ser#1.post 1.nser#1.post 0.of_high#1.post#1.own_province 0.of_high#1.post ///
	i.dofw i.month i.year date_cny_broad date_duanwu_broad date_zhongqiu_broad date_congress date_committee date_zhengxie date_renda ccpprov lhprov, absorb(onid) vce(cluster np of) noconstant
estadd ysumm

test 1.nser#1.post#1.own_province=1.ser#1.post#1.own_province 
estadd scalar p2=r(p)
test 1.nser#1.post=1.ser#1.post
estadd scalar p6=r(p)

coefplot, keep (1.ser#1.post#1.own_province 1.nser#1.post#1.own_province 0.of_high#1.post#1.own_province) ///
	coeflabels(1.ser#1.post#1.own_province="Served x High OF x Post x Same Province" 1.nser#1.post#1.own_province="Not served x High OF x Post x Same Province" ///
	0.of_high#1.post#1.own_province="Low OF x Post x Same Province", interaction(" x ") wrap(10)) ytitle("")  ///
	vertical yline(0) ysc(r(0)) ylabel(#5) recast(bar) ciopts(recast(rcap)) citop barwidt(0.3) levels(90) fcolor(gs10) scheme(s1mono)
graph export "$dir/output/Figure5.pdf",  replace


esttab  using "$dir/output/TableE4.tex", ///
	drop(*.dofw *.month *.year date_* ccpprov lhprov) b(a2) se(a2) /// 
	nodepvar replace label interaction(" x ") star(* 0.10 ** 0.05 *** 0.01) booktabs noomitted nobaselevels noobs ///
	fragment nomtitle nonumber nolines ///
	stats(p2 p6 N r2 ymean, fmt(%9.3fc %9.3fc %16.0fc a2 a2) label("p(Not served = Served) - Same province" ///
	"p(Not served = Served)" "No. of obs." "R-squared" "Mean dep. var."))

	
********************************************************************************

*** FIGURE 6 and TABLE E.5 - Case Study: WQL

set more off
	
reghdfe article 1.gzwan#0.time#1.post 1.gdwan#0.time#1.post  ///
	1.gznwan#0.time#1.post 1.gdnwan#0.time#1.post ///
	1.gzwan#2.time#1.post 1.gdwan#2.time#1.post  ///
	1.gznwan#2.time#1.post 1.gdnwan#2.time#1.post  ///
	i.dofw  i.year  if ((of_wangroup_control==1 & of_province=="广东" )&(np_gz==1|np_gd==1)) ///
	,noconstant absorb(onid) vce(cluster of np)
	
coefplot, keep (1.gzwan#0.time#1.post 1.gdwan#0.time#1.post  ///
	1.gznwan#0.time#1.post 1.gdnwan#0.time#1.post) vertical ///
	order (1.gzwan#0.time#1.post 1.gznwan#0.time#1.post 1.gdwan#0.time#1.post 1.gdnwan#0.time#1.post) ///
	coeflabels(1.gzwan#0.time#1.post="Wan OF x Guangzhou NP x Pre-Wan x Post" 1.gznwan#0.time#1.post="other OF x Guangzhou NP x Pre-Wan x Post"   ///
	1.gdwan#0.time#1.post="Wan OF x other NPs x Pre-Wan x Post" 1.gdnwan#0.time#1.post="other OF x other NPs x Pre-Wan x Post", wrap(10)) ///
	ytitle("") baselevels ///
	yline(0) recast(bar) ciopts(recast(rcap)) citop barwidt(0.3) levels(90) scheme(s1mono)
graph export "$dir/output/Figure6a.pdf", replace

coefplot, keep (1.gzwan#2.time#1.post 1.gdwan#2.time#1.post  ///
	1.gznwan#2.time#1.post 1.gdnwan#2.time#1.post) vertical ///
	order (1.gzwan#2.time#1.post 1.gznwan#2.time#1.post 1.gdwan#2.time#1.post 1.gdnwan#2.time#1.post) ///
	coeflabels(1.gzwan#2.time#1.post="Wan OF x Guangzhou NP x Post-Wan x Post" 1.gznwan#2.time#1.post="other OF x Guangzhou NP x Post-Wan x Post"   ///
	1.gdwan#2.time#1.post="Wan OF x other NPs x Post-Wan x Post" 1.gdnwan#2.time#1.post="other OF x other NPs x Post-Wan x Post", wrap(10)) ///
	ytitle("") baselevels ///
	yline(0) recast(bar) ciopts(recast(rcap)) citop barwidt(0.3) levels(90) scheme(s1mono)
graph export "$dir/output/Figure6b.pdf", replace

test 1.gzwan#0.time#1.post=1.gdwan#0.time#1.post
estadd scalar p1=r(p)
test 1.gzwan#0.time#1.post=1.gznwan#0.time#1.post
estadd scalar p2=r(p)
test 1.gzwan#2.time#1.post=1.gdwan#2.time#1.post
estadd scalar p3=r(p)
test 1.gzwan#2.time#1.post=1.gznwan#2.time#1.post
estadd scalar p4=r(p)

estadd ysumm

esttab using "$dir/output/TableE5.tex", ///
	drop(*.dofw *.year ) b(a2) se(a2) /// 
	order(*#0.time#1.post *#2.time#1.post) ///
	nodepvar replace label interaction(" x ") star(* 0.10 ** 0.05 *** 0.01) booktabs noomitted baselevels noobs ///
	fragment nomtitle nonumber nolines ///
	stats(p1 p2 p3 p4 N r2 ymean, fmt(%9.3f %9.3f %9.3f %9.3f %16.0fc a2 a2) label("\shortstack[l]{p(Wan OF x Guangzhou NP = Wan OF x other NPs)\\pre Wan-scandal}" ///
	"\shortstack[l]{p(Wan OF x Guangzhou NP = other OF x Guangzhou NP)\\pre Wan-scandal}" "\shortstack[l]{p(Wan OF x Guangzhou NP = Wan OF x other NPs)\\post Wan-scandal}" ///
	"\shortstack[l]{p(Wan OF x Guangzhou NP = other OF x Guangzhou NP)\\post Wan-scandal}" ///
	"No. of obs." "R-squared" "Mean dep. var."))


********************************************************************************
